<?php 
if(!isset($_SESSION)) 
{ 
	session_start(); 
}
include 'dao/connection.php';
include_once 'logsearch.php';
ob_start();
$mversion=array("pc","android");
$mstatus=array("login","logout");

if(!isset($_REQUEST['page'])){
	$list["log_ssh.ins_time"]="DESC";
	$list["log_ssh.local_time"]="DESC";
	$list["log_ssh.version"]="DESC";
	$list["log_ssh.status"]="DESC";
	$str="log_ssh.ins_time";
	$_SESSION['sortn']=$str;
	$_SESSION['sort']=$list;
}else{
	$str=$_SESSION['sortn'];
	$list=$_SESSION['sort'];
}

if(array_key_exists("page",$_GET))
    $page  = $_GET['page'];
else
    $page = 1;
$_SESSION['mlogsearch']=array();
/*//$sql="SELECT * from log_ssh where log_ssh.`status`='' and log_ssh.version='' and date(log_ssh.ins_time)='' ORDER BY log_ssh.ins_time desc";
if(isset($_REQUEST['btsearch'])){
	$datefrom=$_REQUEST['datefrom'];
	$dateto=$_REQUEST['dateto'];
	$idversion=$_REQUEST['idversion'];
	$idstatus=$_REQUEST['idstatus'];
	$_SESSION['thucthi']="search";
	$sql="SELECT * from log_ssh where log_ssh.local_ip like '%%' ";
	if(isset($_REQUEST['idversion']) && $_REQUEST['idversion']!="all"){
		$sql .="and log_ssh.version='".$_REQUEST['idversion']."' ";
	}
	if(isset($_REQUEST['idstatus']) && $_REQUEST['idstatus']!="all"){
		$sql .="and log_ssh.`status`='".$_REQUEST['idstatus']."' ";
	}
	if(isset($_REQUEST['datefrom']) && isset($_REQUEST['dateto']) && $_REQUEST['datefrom']!="" && $_REQUEST['dateto']!=""){
		$sql .="and (date(log_ssh.ins_time)>='".$_REQUEST['datefrom']."' and date(log_ssh.ins_time)<='".$_REQUEST['dateto']."') ";
	}else{
		if(isset($_REQUEST['datefrom']) && $_REQUEST['datefrom']!="" ){
			$sql .="and date(log_ssh.ins_time)>='".$_REQUEST['datefrom']."' ";
		}else if(isset($_REQUEST['dateto']) && $_REQUEST['dateto']!=""){
			$sql .="and date(log_ssh.ins_time)<='".$_REQUEST['dateto']."' ";
		}
	}
	$sql .=" ORDER BY log_ssh.ins_time desc";
}else{
	$datefrom="";
	$dateto="";
	$idversion="all";
	$idstatus="all";
	$_SESSION['thucthi']="all";
	$sql="SELECT * from log_ssh  ORDER BY log_ssh.ins_time desc";
}*/
$datefrom='';
$dateto='';
$idversion="all";
$idstatus="all";
$_SESSION['thucthi']="all";
$sql="SELECT * from log_ssh  ORDER BY log_ssh.ins_time desc";
$rs=mysql_query($sql);

$numrow=mysql_num_rows($rs);
if($numrow>0){
	$number_of_page = ceil ( $numrow / $rows_per_page ); 
	while($row=mysql_fetch_array($rs)){
		$ob= new logsearch();
		$ob->Instance($row['log_idx'], $row['local_ip'], $row['local_time'], $row['version'], $row['status'], $row['ins_time']);
		$_SESSION['mlogsearch'][]=$ob;
	}
}
?>
<link rel="stylesheet" type="text/css" href="css/jsDatePick_ltr.min.css" />
<script type="text/javascript" src="css/jsDatePick.min.1.3.js"></script>
<script type="text/javascript">
window.onload = function(){
	new JsDatePick({
		useMode:2,
		target:"datefrom",

		dateFormat:"%Y-%m-%d"
	});
	new JsDatePick({
		useMode:2,
		target:"dateto",

		dateFormat:"%Y-%m-%d"
	});
};

$(function(){
	$('input#btsearchall').css("background","#2A4F7E");
});

function btsearch_click(){
	$('input#btsearch').css("background","#2A4F7E");
	$('input#btsearchall').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchone').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchtwo').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchweek').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchmonth').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	var df=document.getElementById("datefrom").value;
	var dt=document.getElementById("dateto").value;
	var etax = document.getElementById("idversion");
	var ver = etax.options[etax.selectedIndex].value;
	var etax1 = document.getElementById("idstatus");
	var st = etax1.options[etax1.selectedIndex].value;
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp2=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp2.onreadystatechange=function(){
										  if (xmlhttp2.readyState==4 && xmlhttp2.status==200){
										    	document.getElementById("showlist").innerHTML=xmlhttp2.responseText;
										  }
	}
	xmlhttp2.open("POST","ajax/aj_admin_search.php?datefrom="+df+"&dateto="+dt+"&idversion="+ver+"&idstatus="+st,true);
	xmlhttp2.send();
}

function btsearchall_click(){
	$('input#btsearchall').css("background","#2A4F7E");
	$('input#btsearch').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchone').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchtwo').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchweek').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchmonth').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	document.getElementById("datefrom").value="";
	document.getElementById("dateto").value="";
	document.getElementById("idversion").value="all";
	document.getElementById("idstatus").value="all";
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp2=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp2.onreadystatechange=function(){
										  if (xmlhttp2.readyState==4 && xmlhttp2.status==200){
										    	document.getElementById("showlist").innerHTML=xmlhttp2.responseText;
										  }
	}
	xmlhttp2.open("POST","ajax/aj_admin_searchdk.php?type=searchall",true);
	xmlhttp2.send();
}

function btsearchone_click(){
	$('input#btsearchone').css("background","#2A4F7E");
	$('input#btsearchall').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearch').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchtwo').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchweek').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchmonth').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	document.getElementById("datefrom").value="<?php echo date("Y-m-d");?>";
	document.getElementById("dateto").value="<?php echo date("Y-m-d");?>";
	document.getElementById("idversion").value="all";
	document.getElementById("idstatus").value="all";
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp2=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp2.onreadystatechange=function(){
										  if (xmlhttp2.readyState==4 && xmlhttp2.status==200){
										    	document.getElementById("showlist").innerHTML=xmlhttp2.responseText;
										  }
	}
	xmlhttp2.open("POST","ajax/aj_admin_searchdk.php?type=searchone",true);
	xmlhttp2.send();
}

function btsearchtwo_click(){
	$('input#btsearchtwo').css("background","#2A4F7E");
	$('input#btsearchall').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchone').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearch').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchweek').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchmonth').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	document.getElementById("datefrom").value="<?php echo date('Y-m-d',strtotime(date("Y-m-d").'-1 days')); ?>";
	document.getElementById("dateto").value="<?php echo date("Y-m-d");?>";
	document.getElementById("idversion").value="all";
	document.getElementById("idstatus").value="all";
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp2=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp2.onreadystatechange=function(){
										  if (xmlhttp2.readyState==4 && xmlhttp2.status==200){
										    	document.getElementById("showlist").innerHTML=xmlhttp2.responseText;
										  }
	}
	xmlhttp2.open("POST","ajax/aj_admin_searchdk.php?type=searchtwo",true);
	xmlhttp2.send();
}

function btsearchweek_click(){
	$('input#btsearchweek').css("background","#2A4F7E");
	$('input#btsearchall').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchone').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchtwo').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearch').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchmonth').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	document.getElementById("datefrom").value="<?php echo date('Y-m-d',strtotime(date("Y-m-d").'-1 weeks'));?>";
	document.getElementById("dateto").value="<?php echo date("Y-m-d");?>";
	document.getElementById("idversion").value="all";
	document.getElementById("idstatus").value="all";
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp2=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp2.onreadystatechange=function(){
										  if (xmlhttp2.readyState==4 && xmlhttp2.status==200){
										    	document.getElementById("showlist").innerHTML=xmlhttp2.responseText;
										  }
	}
	xmlhttp2.open("POST","ajax/aj_admin_searchdk.php?type=searchweek",true);
	xmlhttp2.send();
}

function btsearchmonth_click(){
	$('input#btsearchmonth').css("background","#2A4F7E");
	$('input#btsearchall').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchone').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchtwo').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearchweek').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	$('input#btsearch').css("background","-moz-linear-gradient(center top,#1692cf ,#309DCF) repeat");
	document.getElementById("datefrom").value="<?php echo date('Y-m-d',strtotime(date("Y-m-d").'-1 months'));?>";
	document.getElementById("dateto").value="<?php echo date("Y-m-d");?>";
	document.getElementById("idversion").value="all";
	document.getElementById("idstatus").value="all";
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp2=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp2.onreadystatechange=function(){
										  if (xmlhttp2.readyState==4 && xmlhttp2.status==200){
										    	document.getElementById("showlist").innerHTML=xmlhttp2.responseText;
										  }
	}
	xmlhttp2.open("POST","ajax/aj_admin_searchdk.php?type=searchmonth",true);
	xmlhttp2.send();
}

function sortdk(flag,type,page,dksort){
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp2=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp2.onreadystatechange=function(){
										  if (xmlhttp2.readyState==4 && xmlhttp2.status==200){
										    	document.getElementById("showlist").innerHTML=xmlhttp2.responseText;
										  }
	}
	xmlhttp2.open("POST","ajax/aj_admin_sortdk.php?flag="+flag+"&type="+type+"&page="+page+"&dksort="+dksort,true);
	xmlhttp2.send();
}

function sort(flag,page,dksort,df,dt,ver,st){
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp2=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp2.onreadystatechange=function(){
										  if (xmlhttp2.readyState==4 && xmlhttp2.status==200){
										    	document.getElementById("showlist").innerHTML=xmlhttp2.responseText;
										  }
	}
	xmlhttp2.open("POST","ajax/aj_admin_sort.php?flag="+flag+"&page="+page+"&dksort="+dksort+"&datefrom="+df+"&dateto="+dt+"&idversion="+ver+"&idstatus="+st,true);
	xmlhttp2.send();
}
</script>
<div style="width:100%">
	<form id="fsearchlog" name="fsearchlog" action="" method="post" >
		<input type="hidden" name="vcontent" value="admin_searchlog_content" />
		<div id="dk" style="width:100%;">
			<table>
				<tr style="font-weight:bold;">
					<td><?=$l_from?></td>
					<td><?=$l_to?></td>
					<td><?=$l_version?></td>
					<td><?=$l_status?></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td ><input type="text" id="datefrom" name="datefrom" value="<?=$datefrom?>" class="ftext" readonly="readonly" style="margin:0;valign:middle;font-size:12px;font-weight:bold;text-align:center;width:100px;height:22px;"/></td>
					<td ><input type="text" id="dateto" name="dateto" value="<?=$dateto?>" class="ftext" readonly="readonly" style="margin:0;valign:middle;font-size:12px;font-weight:bold;text-align:center;width:100px;height:22px;"/></td>
					<td>
						<select style="width:100px;height:24px;font-size:12px;valign:middle;" id="idversion" name="idversion">
							<?php 
							$sl=count($mversion);
							?>
							<option value="all"  
									<?php 
										if($idversion=="all"){
											?>
											selected="selected"
											<?php 
										}
									?>
								>
									<?php echo $l_all;?>
								</option>
							<?php 
							if($sl>0){
								for($i=0;$i<=$sl;$i++){?>
									<option value="<?=$mversion[$i]?>"  
										<?php 
											if($idversion==$mversion[$i]){
												?>
												selected="selected"
												<?php 
											}
										?>
									>
										<?php echo $mversion[$i]?>
									</option>
								<?php }
							}
							?>
						</select> 
					</td>
					<td>
						<select style="width:100px;height:24px;font-size:12px;valign:middle;" id="idstatus" name="idstatus">
							<?php 
							$sl=count($mstatus);
							?>
							<option value="all"  
									<?php 
										if($idstatus=="all"){
											?>
											selected="selected"
											<?php 
										}
									?>
								>
									<?php echo $l_all;?>
								</option>
							<?php 
							if($sl>0){
								for($i=0;$i<=$sl;$i++){?>
									<option value="<?=$mstatus[$i]?>"  
										<?php 
											if($idstatus==$mstatus[$i]){
												?>
												selected="selected"
												<?php 
											}
										?>
									>
										<?php echo $mstatus[$i]?>
									</option>
								<?php }
							}
							?>
						</select> 
					</td>
					<td style="margin:0;valign:middle;" id="td_btsearch">
						<input type="button" onclick="btsearch_click();" id="btsearch" name="btsearch" value="<?=$l_search;?>" class="btnupbg btnupload" style="width:80px;margin: 0;"/>
					</td>
					<td style="margin:0;valign:middle;" id="td_btsearchall">
						<input type="button" onclick="btsearchall_click();" id="btsearchall" name="btsearchall" value="<?=$l_all;?>"  class="btnupbg btnupload" style="width:80px;margin: 0;" />
					</td>
					<td style="margin:0;valign:middle;" id="td_btsearchone">
						<input type="button" onclick="btsearchone_click();" id="btsearchone" name="btsearchone" value="<?=$l_searchone;?>"  class="btnupbg btnupload" style="width:80px;margin: 0;"/>
					</td>
					<td style="margin:0;valign:middle;" id="td_btsearchtwo">
						<input type="button" onclick="btsearchtwo_click();" id="btsearchtwo" name="btsearchtwo" value="<?=$l_searchtwo;?>"  class="btnupbg btnupload" style="width:80px;margin: 0;"/>
					</td>
					<td style="margin:0;valign:middle;" id="td_btsearchweek">	
						<input type="button" onclick="btsearchweek_click();" id="btsearchweek" name="btsearchweek" value="<?=$l_searchweek;?>"  class="btnupbg btnupload" style="width:80px;margin: 0;"/>
					</td>
					<td style="margin:0;valign:middle;" id="td_btsearchmonth">	
						<input type="button" onclick="btsearchmonth_click();" id="btsearchmonth" name="btsearchmonth" value="<?=$l_searchmonth;?>"  class="btnupbg btnupload" style="width:80px;;margin: 0;"/>
					</td>
				</tr>
			</table>
		</div>
		<div class="clear"><br></div>
		<div id="showlist" style="width:100%">
			<table style="width:100%;text-align:center;border:1px solid;border-color: black;">
				<tr style="background: #2A4F7E;height:30px;color:white;text-align:center;font-weight:bold;">	
					<td width="50px" style="padding:5px"><?=$l_no?></td>
					<td width="100px"><?=$l_ip?></td>
					<td width="200px" valign="middle"><a onclick="sortdk('sort','searchall',<?=$page?>,'log_ssh.ins_time');" style="cursor:pointer;"><?=$l_servertime?></a>
					<img 
					<?php 
						if($_SESSION['sortn']=='log_ssh.ins_time'){
							if($_SESSION['sort'][$_SESSION['sortn']]=="DESC"){
								?>
								src="images/sd.png" 
								<?php 
							}else{
								?>
								src="images/sa.png" 
								<?php 
							}
						}else{?>
							src="images/sall.png"
							<?php 
						}
					?> style="width:20px;height:20px;" />
					</td>
					<td width="200px"><a onclick="sortdk('sort','searchall',<?=$page?>,'log_ssh.local_time');" style="cursor:pointer;"><?=$l_localtime?></a>
					<img 
					<?php 
						if($_SESSION['sortn']=='log_ssh.local_time'){
							if($_SESSION['sort'][$_SESSION['sortn']]=="DESC"){
								?>
								src="images/sd.png" 
								<?php 
							}else{
								?>
								src="images/sa.png" 
								<?php 
							}
						}else{?>
							src="images/sall.png"
							<?php 
						}
					?> style="width:20px;height:20px;" />
					</td>
					<td width="100px"><a onclick="sortdk('sort','searchall',<?=$page?>,'log_ssh.version');" style="cursor:pointer;"><?=$l_version?></a>
					<img 
					<?php 
						if($_SESSION['sortn']=='log_ssh.version'){
							if($_SESSION['sort'][$_SESSION['sortn']]=="DESC"){
								?>
								src="images/sd.png" 
								<?php 
							}else{
								?>
								src="images/sa.png" 
								<?php 
							}
						}else{?>
							src="images/sall.png"
							<?php 
						}
					?> style="width:20px;height:20px;" />
					</td>
					<td width="100px"><a onclick="sortdk('sort','searchall',<?=$page?>,'log_ssh.status');" style="cursor:pointer;"><?=$l_status?></a>
					<img 
					<?php 
						if($_SESSION['sortn']=='log_ssh.status'){
							if($_SESSION['sort'][$_SESSION['sortn']]=="DESC"){
								?>
								src="images/sd.png" 
								<?php 
							}else{
								?>
								src="images/sa.png" 
								<?php 
							}
						}else{?>
							src="images/sall.png"
							<?php 
						}
					?> style="width:20px;height:20px;" />
					</td>
				</tr>
			<?php 
			if(isset($_SESSION['mlogsearch'])){
				$sl=count($_SESSION['mlogsearch']);
				if($sl>0){
					$slc=$sl;
					if($sl>$page_end){
						$slc=$page_end;
					}
					for ($i=$page_start;$i<$slc;$i++){
						//if ( $i >= $page_start  ){
							$obj= unserialize (serialize ($_SESSION['mlogsearch'][$i]));
							if($i%2==0){
								?>
								<tr class="ctb" style="padding:5px;background: #eef">
								<?php 
							}else{
								?>
								<tr class="ctb" style="padding:5px">
								<?php 
							}
							?>
								<td width="50px" style="text-align:right;padding:5px"><?=($i+1)?></td>
								<td width="100px"><?=$obj->local_ip?></td>
								<td width="200px"><?=$obj->ins_time?></td>
								<td width="200px"><?=$obj->local_time?></td>
								<td width="100px"><?=$obj->version?></td>
								<td width="100px"><?=$obj->status?></td>
							</tr>
							<?php 
						//}
						/*if (($i+1) >= $page_end){ 
							break; 
						}*/
					}
					
					if ( $number_of_page > 1 ){
						?>
						<tr>
							<td colspan="7" style="background:#ccc" >
								<span style="float:left;padding:5px;"><b><?=$l_record?></b> : <b><?=number_format($sl)?></b></span>
								<span style="background:#fff; padding:1px; display: inline-block;">
								<?php 
									if ($page==1)
										$p=2;
									else if ($page==$number_of_page)
										$p=$number_of_page-1;
									else $p=$page;
									if($page!=1){?>
										<a onclick="sortdk('none','searchall',1,'<?=$str?>');" ><span class='button_next'><b><?php echo "<<<";?></b></span> </a>
										<a onclick="sortdk('none','searchall',<?=($page-1)?>,'<?=$str?>');" ><span class='button_next'><b><?php echo " << ";?></b></span> </a>
									<?php  
									}
									for ( $i = $p-1; $i <= $p+1; $i++ ) {
										if ($i<=$number_of_page && $i>0){
											if ($i==$page){
												echo "<span class='button_next' style='color:red'><b>".$i."</b></span>"; 
											}else{
											?>
												<a onclick="sortdk('none','searchall',<?=$i?>,'<?=$str?>');" ><span class="button_next" style="color: #508e21;">
												<?php 
												echo "<b>".$i."</b>";
												?>
												</span> </a>
												<?php 
											}	
										}
									}
									if($page!=$number_of_page){ ?>
										<a onclick="sortdk('none','searchall',<?=($page+1)?>,'<?=$str?>');"><span class='button_next'><b><?php echo ">>";?></b></span> </a>
										<a onclick="sortdk('none','searchall',<?=($number_of_page)?>,'<?=$str?>');" ><span class='button_next'><b><?php echo ">>>";?></b></span> </a>
									<?php 
									}
								?>
								</span>
							</td>
						</tr>
						<?php 
					}else{
					?>
						<tr><td colspan="7" style="background:#ccc;text-align:left;" ><b><?=$sl?></b></td></tr>
					<?php 	
					}
				}else{
					?>
					<tr><td colspan="6" style="padding-left: 10px"><?=$l_empty?></td></tr>
					<?php 
				}
			}
			?>
			</table>
		</div>
	</form>
</div>
<div class="clear"><br></div>
<?php mysql_close($connection);?>